﻿/* $RCSFile: CrmDiv.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/UI/WebControls/CrmDiv.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:29  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Globalization;

using AddonNice.Diagnostics;
using AddonNice.Settings;
using AddonNice.Core;
using AddonNice.UI;
using AddonNice.UI.WebControls;
using AddonNice.Helpers;
using AddonNice.Security;
using AddonNice.Configuration;

using Trace2    =   System.Diagnostics.Trace;
using Path2     =   AddonNice.Settings.Path;



namespace AddonNice.UI.WebControls
{
    /// <summary>
    /// Div Hidden under Crm
    /// </summary>
    public class CrmDiv : HtmlGenericControl
    {
        public CrmDiv()
		{
            if (WebControlsTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine( "[V]CrmDiv Ctor BEG tag div",WebControlsTraceSwitch.Sw.Info);
            TagName         =   "div";
		}
        public CrmDiv(string tgNm)
		{
            if (WebControlsTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]CrmDiv Ctor BEG tgNm: {0}",tgNm),WebControlsTraceSwitch.Sw.Info);
            TagName         =   tgNm;
		}

		protected override void OnInit(EventArgs e)
		{
            if (WebControlsTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]CrmDiv OnInit BEG DesignMode : {0}, PortalSettings.IsUnderCRM: {1}",
                    DesignMode,(DesignMode || (HttpContext.Current == null)) ? false:PortalSettings.IsUnderCRM),WebControlsTraceSwitch.Sw.Info);
            if ( !DesignMode && (HttpContext.Current == null || PortalSettings.IsUnderCRM) )
            {
                Visible = false;
            }
            if (WebControlsTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine( "[V]CrmDiv OnInit END.",WebControlsTraceSwitch.Sw.Info);
        }
    }
}
